<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<script type="text/javascript">
$(document).ready(function(){
  var a=$("select option:selected").text();
  var obj={};
  obj.id=a;
  $.post("<%= basePath%>goods/find.do",obj,dd,"json");

});
function dd(data){
$("#in1").val("1");
 $("#t2").empty();
   $("#t2").val(data.sum);
   $("#t1").empty();
   $("#t1").append(data.name);
   $("#tdd").empty();
   $("#tdd").append("<input type='text' name='num' class='digits' size='5' min='1' max='"+data.sum+"' value='1'/><span class='info'></span>");
  

}
function tj(){

  var s= $("#tdd input").val();
   var s1=$("#t2").val();
   $("#t2").val(s1);
}
function aa(){
  var s=$("select option:selected").text();
  var obj={};
  obj.id=s;
  $.post("<%= basePath%>goods/find.do",obj,dd,"json");
   }

</script>
<div class="pageContent">
	<form  onsubmit="return validateCallback(this,navTabAjaxDone)" action="breakage/addmessage.do" method="post">
		<div class="pageFormContent" layoutH="56" id="dd4">
		<table class="searchContent">
		  <tr>
		    <td>报损时间：</td><td><input type="text" class="date" readonly="true" name="create_time" value="" id="time"/></td>
            <td>受损信息：</td><td><input type="text" name="injury_desc" value="" id="injury"/></td>
            
		  </tr>
		</table>
		<table class="table" width="96%" layoutH="138">
		<thead>
			<tr>
                <th width="70">产品编码</th>
				<th width="150">库房</th>
				<th width="40" >库存数量</th>
				<th width="150">报损数量</th>
			</tr>
		</thead>
		<tbody id="tb1">
		<tr>
		<td>
		<select onchange="aa()" name="sid">
		<c:forEach items="${requestScope.list}" var="s">
	        <option value="${s.id }">${s.id }</option>
		</c:forEach>
		</select>
		</td>
		<td id="t1" ><br></td>
		<td ><input id="t2" name="count" readonly="readonly"/></td>
		<td id="tdd"></td>
		</tr>
		</tbody>
		</table>
</div>
		<div class="formBar">
			<ul>
				<li><div class="buttonActive"><div class="buttonContent"><button type="submit" onclick="tj()">提交</button></div></div></li>
				<li>
					<div class="button"><div class="buttonContent"><button type="button" class="close">取消</button></div></div>
				</li>
			</ul>
		</div>
</form>
</div>
